package com.ruoyi.production.service.impl.pesticide;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.production.mapper.pesticide.PesticideNameMapper;
import com.ruoyi.production.domain.pesticide.PesticideName;
import com.ruoyi.production.service.pesticide.IPesticideNameService;

/**
 * 农药名称Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-12
 */
@Service
public class PesticideNameServiceImpl implements IPesticideNameService
{
    @Autowired
    private PesticideNameMapper pesticideNameMapper;

    /**
     * 查询农药名称
     *
     * @param pesticideNameId 农药名称ID
     * @return 农药名称
     */
    @Override
    public PesticideName selectPesticideNameById(Long pesticideNameId)
    {
        return pesticideNameMapper.selectPesticideNameById(pesticideNameId);
    }

    /**
     * 查询农药名称列表
     *
     * @param pesticideName 农药名称
     * @return 农药名称
     */
    @Override
    public List<PesticideName> selectPesticideNameList(PesticideName pesticideName)
    {
        return pesticideNameMapper.selectPesticideNameList(pesticideName);
    }

    /**
     * 新增农药名称
     *
     * @param pesticideName 农药名称
     * @return 结果
     */
    @Override
    public int insertPesticideName(PesticideName pesticideName)
    {
        pesticideName.setCreateTime(DateUtils.getNowDate());
        return pesticideNameMapper.insertPesticideName(pesticideName);
    }

    /**
     * 修改农药名称
     *
     * @param pesticideName 农药名称
     * @return 结果
     */
    @Override
    public int updatePesticideName(PesticideName pesticideName)
    {
        pesticideName.setUpdateTime(DateUtils.getNowDate());
        return pesticideNameMapper.updatePesticideName(pesticideName);
    }

    /**
     * 批量删除农药名称
     *
     * @param pesticideNameIds 需要删除的农药名称ID
     * @return 结果
     */
    @Override
    public int deletePesticideNameByIds(Long[] pesticideNameIds)
    {
        return pesticideNameMapper.deletePesticideNameByIds(pesticideNameIds);
    }

    /**
     * 删除农药名称信息
     *
     * @param pesticideNameId 农药名称ID
     * @return 结果
     */
    @Override
    public int deletePesticideNameById(Long pesticideNameId)
    {
        return pesticideNameMapper.deletePesticideNameById(pesticideNameId);
    }
}
